package com.qk.management.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 16778
 * @date 2025/10/7 16:40
 * @description
 */
@Mapper
public interface CourseMapper {
    List<Course> page(String name, Integer subject, Integer target);

    @Delete("delete from course where id = #{id}")
    void delete(Integer id);

    @Insert("insert into course(subject,name,price,target,description,create_time,update_time)" +
            "values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);

    @Select("select * from course where id = #{id}")
    Course getById(Integer id);

    @Update("update course set subject = #{subject},name = #{name},price = #{price},target=#{target}," +
            "description = #{description},create_time=#{createTime},update_time = #{updateTime} where id = #{id}")
    void update(Course course);

    @Select("select * from course")
    List<Course> findALl();

    @Select("select * from course where subject = #{subject}")
    List<Course> selectBySubject(String subject);
}
